package com.bml.architect.netty.serialiable.codec;

import com.bml.architect.entity.MsgProto;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

public class MsgProtoEncoder extends MessageToByteEncoder<MsgProto> {
    @Override
    protected void encode(ChannelHandlerContext ctx, MsgProto msg, ByteBuf out) throws Exception {
        out.writeInt(msg.getLength());
        out.writeBytes(msg.getContent());
    }
}
